<%@ page import="java.time.LocalDate" %>
<%@ page import="cn.hutool.http.HttpRequest" %>
<%@ page import="cn.hutool.http.Header" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %><%
    try {
        out.println("start." + "<br>");
        LocalDate currentDate = LocalDate.now();
        // 获取前一天的日期
        LocalDate previousDate = currentDate.minusDays(1);
        java.time.format.DateTimeFormatter formatter = java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd");
        String formattedDate = previousDate.format(formatter);
        String startTime = formattedDate + " 00:00:01";
        String endTime = formattedDate + " 23:59:59";

        String sbxlh = "19180080000679";
        Map<String, Object> paramMap = new HashMap<>();
        List<String> snList = new ArrayList<>();
        snList.add(sbxlh);
        paramMap.put("SN", snList);
        long taskId = System.currentTimeMillis();
        paramMap.put("taskId", taskId);
        paramMap.put("type", "queryRecordData");
        Map<String, Object> mapTemp = new HashMap<>();
        mapTemp.put("begin_time", "2024-12-02 00:00:01");
        mapTemp.put("end_time", "2024-12-02 12:59:59");
        mapTemp.put("limit", 10);
        mapTemp.put("offset", 0);
        paramMap.put("Data", mapTemp);
        out.println("paramMap is:" + JSONObject.toJSONString(paramMap) + "<br>");
        String url = "http://192.168.1.43:1820/Face/sendControl";
//        String url = "http://192.168.1.43:1820/Face/getDeviceConf";
//        paramMap = new HashMap<>();
//        paramMap.put("SN", "19180080000679");
//        out.println("url is:" + url + "<br>");
        String result = HttpRequest.post(url)
                .header(Header.CONTENT_TYPE, "application/json")
                .body(JSONObject.toJSONString(paramMap))
                .timeout(20000)
                .execute().body();
        out.println("result is:" + result + "<br>");
    } catch (Exception e) {
        out.println(e + "\n");
    }
%>